#ifndef Tui_TCount_h
#define Tui_TCount_h


#include "TBase.h"


using namespace rapidxml;

class TCounterPanel:public TPanel{
    
public:
    TCounterPanel();
    
    CCNode* pCom;
    
    CREATE_FUNC(TCounterPanel);
    
    virtual bool init(); 
    
    virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
    
    DEV_PROPERTY(int, m_nMaxNum, MaxNum);
	DEV_PROPERTY(bool, isFirst, First);
    
    virtual void registerWithTouchDispatcher();
    virtual void procTuiEvent(const string&,TPanelItem*);
protected: 
    void hide(); 
     
    
}; 

class TCount:public TPanel{
public:
    TCount();
    ~TCount();
    
    virtual bool init();
    
    CREATE_FUNC(TCount);
    
    static TCount*  create(xml_node<> * pItem);
    
    virtual  void  initWidthConf(xml_node<> * pItem);
      
    void onShow();
    
    void onHide();

	DEV_PROPERTY(bool, isNeedReset, NeedReset);
    
    bool getIsOpen();
    
    int getNum();
    
    virtual void selected();
    
    virtual void unselected();
    
    DEV_PROPERTY_READONLY(int, m_nMaxNum, MaxNum);
    
    void setMaxNum(int num);
    
    void setNum(int num);
    
    void setTarget(CCObject *rec, SEL_MenuHandler selector);
    
    void setCompleteTarget(CCObject *rec, SEL_MenuHandler selector);
    void setCloseTarget(CCObject *rec, SEL_MenuHandler selector);
    
    void inputEnd();
    void inputClose();
public:
    
    CCObject*       m_pListener;
    SEL_MenuHandler    m_pfnSelector;
    
    CCObject*       m_pClListener;
    SEL_MenuHandler    m_pClfnSelector;
    
    CCObject*       m_pCListener;
    SEL_MenuHandler    m_pCfnSelector;
    
    int m_nNum;
    CCNode* m_pCountPanel;
    CCLabelTTF* m_pLabel;  
};



#endif
